Programming iOS 9: Dive Deep into Views, View Controllers, and Frameworks by Matt Neuburg

Programming iOS 9: Dive Deep into Views, View Controllers, and Frameworks by Matt Neuburg

Author:Matt Neuburg [Neuburg, Matt]
Language: eng
Format: epub, pdf
ISBN: 9781491936856
Publisher: O’Reilly Media, Inc.
Published: 2015-12-15T03:00:00+00:00


Figure 8-11. Phone directory app in edit mode

Let’s implement this for phone numbers in our name-and-phone-number app, allowing the user to give a person any quantity of phone numbers (Figure 8-11):

override func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle { if indexPath.section == 1 { let ct = self.tableView( tableView, numberOfRowsInSection:indexPath.section) if ct-1 == indexPath.row { return .Insert } return .Delete; } return .None }

The person’s name has no editing control (a person must have exactly one name), so we prevent it from indenting in edit mode:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.